<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{$appConfigs.title}</title>

    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/easyui/themes/{$page_theme | default: 'default'}/easyui.css">
    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="{$contextPath}/pas/style/my.css">
    <script type="text/javascript" src="{$contextPath}/pas/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="{$contextPath}/pas/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="{$contextPath}/pas/javascript/my.js"></script>
    
</head> 
<body onpageshow="resetPagination('dg')">
    {datagrid id="dg" datasource="/invest/SummaryInvestDailyService/findAll.do" view="i_summary_invest_daily"}
    
    <script>
    var user_id={$principal.id};
    {literal}
    field_formatters.cost=function (value, row, index){
      if(value) 
        return formatCurrency(value);
    }
    field_formatters.amount=function (value, row, index){
      if(value) 
        return formatCurrency(value);
    }
    field_formatters.profit=function (value, row, index){
      if(value) 
        if(value > 0)
          return "<font color='green'>"+formatCurrency(value)+"</font>";
        else
          return "<font color='red'>"+formatCurrency(value)+"</font>";
    }
    field_formatters.period_profit=function (value, row, index){
      if(value) 
        if(value > 0)
          return "<font color='green'>"+formatCurrency(value)+"</font>";
        else
          return "<font color='red'>"+formatCurrency(value)+"</font>";
    }
    field_formatters.period_buy_count=function (value, row, index){
      if(value) 
        return value;
    }
    field_formatters.period_buy_amount=function (value, row, index){
      if(value) 
        return formatCurrency(value);
    }
    field_formatters.period_sell_count=function (value, row, index){
      if(value) 
        return value;
    }
    field_formatters.period_sell_amount=function (value, row, index){
      if(value) 
        return formatCurrency(value);
    }
    field_formatters.tax=function (value, row, index){
      if(value) 
        return formatCurrency(value);
    }
    field_formatters.limit_rate=function (value, row, index){
    	if(value)
			return (parseInt(value * 10000) / 100)+"%";
    }
    field_formatters.actually_rate=function (value, row, index){
    	if(value) {
    		if(row.limit_rate && row.limit_rate < value)
				return "<font color='red'>"+(parseInt(value * 10000) / 100)+"%</font>";
			else
				return (parseInt(value * 10000) / 100)+"%";
		}
    }
    function refreshData() {
        postByAjax('/invest/SummaryInvestDailyService/createByUserId.do?user_id='+user_id,null, reload);
    }
    {/literal}
    </script>
</body>
</html>